package com.platform.api.bzproject.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.api.bzproject.dao.BzConfigMapper;
import com.platform.api.bzproject.model.BzConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author guoyunfei on 2021/7/9 14:03
 * @className BzConfigMapper
 * @description TODO
 * @Version 1.0
 */
@Service
@Transactional(rollbackFor=Exception.class)
public class BzConfigService extends ServiceImpl<BzConfigMapper, BzConfig> {

    @Autowired
    private BzConfigMapper bzConfigDao;


    public List<BzConfig> getConfig(String type){

        QueryWrapper<BzConfig> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("enable",1);
        queryWrapper.eq("type",type);
        return bzConfigDao.selectList(queryWrapper);
    }

    public BzConfig getByType(String type){
        return bzConfigDao.getByType(type);
    }

    public String getNotifyDomain(){
        return bzConfigDao.getByType("notify_url").getValue();
    }

}
